//////////////////////////////////////////////////////////////////////////////////
//	 Copyright 2011 by Yosef Grabivker, ryuho@homenetworksoft.com
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
//////////////////////////////////////////////////////////////////////////////////

#ifndef _SYS_LOG_OPTIONS_YG_H__
#define _SYS_LOG_OPTIONS_YG_H__

#include "def.h"

class CSysLogOptions: public wxPanel
{
public:
								CSysLogOptions( wxWindow* pParent );
	virtual						~CSysLogOptions(void);
	
	
	bool						GetSysLogFromRouterOnly()			{ return m_pcbLogFromRouter->GetValue(); }
	void						SetSysLogFromRouterOnly(bool bSet)	{ m_pcbLogFromRouter->SetValue(bSet);	 }

	bool						GetLogBlockedMAC()					{ return m_pcbLogMACBlocks->GetValue();  }
	void						SetLogBlockedMAC(bool bSet)			{ m_pcbLogMACBlocks->SetValue(bSet);	 }


	SYSLOGACTIONS				GetSysLogActions()					{ return m_actions;						 }
	void						SetSysLogActions(const SYSLOGACTIONS& act);

	void						SetEnableSyslogSave( bool bSet );
	bool						GetEnableSyslogSave();

	void						SetSyslogSaveFileName( const wxString& str );
	wxString					GetSyslogSaveFileName();

	void						SetSyslogSaveLimit( long lLimit );
	long						GetSyslogSaveLimit();

	void						SetSysLogUDPPort(long lLimit);
	long						GetSysLogUDPPort();

	void						SetEnableSyslogAutoConfig( bool bSet );
	bool						GetEnableSyslogAutoConfig();

	void						SetSyslogAutoConfigLevel(long lLimit);
	long						GetSyslogAutoConfigLevel();

protected:
	void						OnSelectLogFileName(wxCommandEvent& event);
	void						OnTogleLogSaving(wxCommandEvent& event);
	void						OnTemplateUpdated(wxCommandEvent& ev);
	void						OnActionUpdated(wxCommandEvent& ev);
	void						OnTogleAutoConfig(wxCommandEvent& ev);

	DECLARE_EVENT_TABLE()

private:
	void						GetAction(unsigned char nIDX, SYSLOGACTION& action);
	void						SetAction(unsigned char nIDX, const SYSLOGACTION& action);


private:
	class wxCheckBox*			m_pcbLogFromRouter;
	class wxCheckBox*			m_pcbLogMACBlocks;

	class wxBoxSizer*			m_pLogFileSizer;
	class wxCheckBox*			m_pcbSaveLog;
	class wxTextCtrl*			m_ptcDirName;
	class wxComboBox*			m_pLimitSelector;

	SYSLOGACTIONS				m_actions;

	class wxTextCtrl**			m_ppMsgTemplate;
	class wxComboBox**			m_ppReaction;

	wxString					m_strSysLogPort;
	class wxTextCtrl*			m_pSyslogPort;

	class wxBoxSizer*			m_pSyslogAutoConfigSizer;
	class wxCheckBox*			m_pcbSyslogAutoConfig;
	class wxComboBox*			m_pSysLogLevelSelector;
};

#endif //_SYS_LOG_OPTIONS_YG_H__